const FIELD_CLASS_GROUP_MAP = [
	
];
const FIELD_CLASS_CONFIG ={
	defaultGroup:{
		"name":"默认分组",
			"code":"_default",
			"classList":[]
	},
	adapterGroup:function()
}



const fieldClassGroup = {
	"groupAll":function(flowNodes){
		let defaultGroup = FIELD_CLASS_CONFIG.defaultGroup;
		
		let groupMap = {};
		let groupList = [];
		for(let fgn of FIELD_CLASS_GROUP_MAP){
			let tempFlowGroup = {
				"name":fgn.name,
				"code":fgn.code,
				"classList":[]
			};
			for(let ffs of fgn.flows){
				groupMap[ffs] = tempFlowGroup;
			}
			groupList.push(tempFlowGroup);
		}
		
		for(let fnode of flowNodes){
			if(groupMap[fnode.name]){
				groupMap[fnode.name].classList.push(fnode);
			}else{
				defaultGroup.classList.push(fnode);
			}
		}
		
		return [defaultGroup,...groupList.filter(function(gp){return gp.classList.length>0;})];
	},
	initGroupMap: function(name,code, flows){
		FIELD_CLASS_GROUP_MAP.push({
			"name":name,"code":code,"classList":[],"flows": flows
		});
	},
	initDefaultGroup: function(name,code){
		FIELD_CLASS_CONFIG.defaultGroup.name = name;
		FIELD_CLASS_CONFIG.defaultGroup.code = code;
		
	},
	getDefaultGroup: function(){
		return FIELD_CLASS_CONFIG.defaultGroup;
	}
	
	
};

export default fieldClassGroup